﻿using Domain.Entities.Roles;
using FluentMigrator;
using FrameworkCore.Extensions;

namespace Domain.Migrations.Roles;

[Migration(202501062039)]
public class RoleAddColumn : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Table(MigrationExpressions.GetTableName(typeof(Role)))        
          .AddColumn(MigrationExpressions.ColumnNameFor<Role>(nameof(Role.Name))).AsString(20).Nullable().WithColumnDescription("角色名称")
          .AddColumn(MigrationExpressions.ColumnNameFor<Role>(nameof(Role.HasAdministrator))).AsBoolean().Nullable().WithDefaultValue(false).WithColumnDescription("是否具有超级管理员权限")
          .AddColumn(MigrationExpressions.ColumnNameFor<Role>(nameof(Role.HasNegative))).AsBoolean().Nullable().WithDefaultValue(false).WithColumnDescription("是否具有负面特性")
          .AddColumn(MigrationExpressions.ColumnNameFor<Role>(nameof(Role.Enabled))).AsBoolean().Nullable().WithDefaultValue(true).WithColumnDescription("启用");
    }
}
